//
//  SWProvinceRegionReq.swift
//  ChildStory
//
//  Created by linhan on 2017/1/16.
//  Copyright © 2017年 Aiya. All rights reserved.
//

import Foundation
class SWProvinceFetchReq: SWBaseRequest
{
    override init()
    {
        super.init()
        api = SWRequestAPI.RegionFetch
    }
    
    override var url:String
    {
        return "http://mpic.bbyiya.com/region/getlist"
    }
    
    override var params:Any?
    {
        return ["type":0,"code":""]
    }
    
    override func JSONToModel(_ json:JSON, JSONString:String, JSONData:Data) -> AnyObject?
    {
        return Mapper<SWProvinceFetchRsp>().map(JSONString: JSONString)
    }
}

class SWProvinceFetchRsp: NSObject,Mappable
{
    var statu:String?
    var provinces:[SWProvinceRsp] = []
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        statu          <- map["Statu"]
        provinces      <- map["BaseModle"]
    }
}

class SWProvinceRsp: NSObject,Mappable
{
    var code:Int?
    var title:String?
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        code       <- map["code"]
        title      <- map["province"]
    }
}
